package org.yiqixue.accounts.entity;

import jakarta.persistence.*;
import lombok.Data;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 账户实体类
 * 用于存储账户信息
 */
@Entity
@Data
@EntityListeners(AuditingEntityListener.class)
@Table(name = "account")
public class Account {
    
    @Id
    @Column(name = "account_number")
    private String accountNumber;
    
    @Column(nullable = false)
    private String phoneNumber;
    
    @Column(nullable = false)
    private BigDecimal balance;
    
    @Version
    private Long version;

    @CreatedDate
    private LocalDateTime createdAt;

    @LastModifiedDate
    private LocalDateTime updatedAt;

    @CreatedBy
    private String createdBy;

    @LastModifiedBy
    private String updatedBy;
} 